#include <stdio.h>
#define N 50

int main()
{
    int a[N][N], i, j, n;
    printf("输入打印行数:\n");
    scanf("%d", &n); // 输入打印行数
    for (i = 0; i < n; i++){
        for (j = 0; j <= i; j++)
        {
            if (j == 0 || j == i)
            {
                a[i][j] = 1;
            }
            else
            {
                a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
            }
                printf("%d ", a[i][j]);
            }
            printf("\n");
        }        

    return 0;
}